# 读文件
# f = open(r"liu.txt")
f = open(r'E:\python\python_pro\python_230901\homework\liuyingge\lianxi\07-文件操作\liu.txt')
data = f.read()
print(data)
f.close()

# 读文件（重点）
with open(r'liu.txt') as f:
    data = f.read()
    print(data)

# 写文件
with open(r'test.txt', mode='w') as f:
    s = 'hello world'
    f.write(s)

# 复制一张图片
with open(r'C:\Users\鸽子\Desktop\29.png', mode='rb') as f1, open(r"C:\Users\鸽子\Desktop\30.png", mode='wb') as f2:
    data = f1.read()
    f2.write(data)
